package com.ln.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ln.dao.IBaseDAO;
import com.ln.dao.impl.UserInfoDAO;
import com.ln.pojo.impl.UserInfoPOJO;
import com.ln.service.BaseService;

@Service
@Transactional
public class UserInfoService extends BaseService<UserInfoPOJO, Integer> {
	@Autowired
	private UserInfoDAO userInfoDAO;

	@Override
	protected IBaseDAO<UserInfoPOJO, Integer> getDao() {
		return userInfoDAO;
	}
	
	//保存用户信息
	public int save(final UserInfoPOJO userInfoPOJO) {
		return (userInfoDAO.isExistId(userInfoPOJO.getUser_id()) > 0)
				?super.update(userInfoPOJO)
						:super.insert(userInfoPOJO);
	}
	
}
